package org.gpp.proj1.demo.model;

import org.gpp.proj1.util.ModelFactory;

import com.jme.app.AbstractGame;
import com.jme.app.SimpleGame;
import com.jme.math.Vector3f;
import com.jme.scene.Node;
import com.jme.scene.Spatial;

public class ModelLoader extends SimpleGame {

	// as coisas do scene graph
	private Spatial model;
	private Node node;
	
	/**
	 * @see com.jme.app.BaseSimpleGame#simpleInitGame()
	 */
	@Override
	protected void simpleInitGame() {

		display.setTitle("Model Loader");
		this.node = new Node("myNode");

		// Carrega o modelo
		// ==============================================================

		
		this.model = ModelFactory.getInstance().getModel("res/models/mecha_full.ms3d");
		model.setLocalScale(.5f); // escala
		
		this.node.attachChild(this.model);

		// faz as tranformadas na c�mera
		cam.setLocation(new Vector3f(50.0f, 50.0f, 50.0f)); // transla��o
		cam.lookAt(new Vector3f(0,0,0), new Vector3f(0,1,0)); // rota��o
		cam.update();
		
		// enchendo o scene graph com o n�
		this.rootNode.attachChild(this.node);
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		ModelLoader app = new ModelLoader();
		app.setDialogBehaviour(AbstractGame.FIRSTRUN_OR_NOCONFIGFILE_SHOW_PROPS_DIALOG);
		app.start();
	}
}